package request

type AddRole struct {
	Role_name   string `form:"role_name" json:"role_name" binding:"required"`
	Permissions []uint `form:"permissions" json:"permissions" binding:"-"`
}

func (addRole AddRole) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"role_name.required": "角色名称不能为空",
	}
}

type EditRole struct {
	Role_id     uint   `form:"role_id" json:"role_id" binding:"required"`
	Role_name   string `form:"role_name" json:"role_name" binding:"required"`
	Permissions []uint `form:"permissions" json:"permissions" binding:"-"`
}

func (editRole EditRole) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"role_id.required":   "角色id不能为空",
		"role_name.required": "角色名称不能为空",
	}
}

type GetRoleList struct {
	List
}

type RoleId struct {
	Role_id uint `form:"role_id" json:"role_id" binding:"required"`
}

func (delRole RoleId) GetMessages() ValidatorMessages {
	return ValidatorMessages{
		"role_id.required": "角色id不能为空",
	}
}

type SaveRoleUser struct {
	RoleId
	Id_source []uint `form:"id_source" json:"id_source" binding:"required"`
	Id_result []uint `form:"id_result" json:"id_result" binding:"required"`
}

func (saveRoleUser SaveRoleUser) GetMessages() ValidatorMessages {
	messages := ValidatorMessages{
		"role_id.required":   "角色id不能为空",
		"id_source.required": "角色源id不能为空",
		"id_result.required": "角色结果id不能为空",
	}
	return messages
}
